<?php

use common\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use common\enums\StatusEnum;
/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */

$this->title = '修改';
$this->params['breadcrumbs'][] = ['label' => '报修管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
//Yii::$app->debris->p($model->getNextStatuses());
//foreach ($model->getNextStatuses() as $key => $nextStatus) {
//   p($nextStatus['status']->getLabel());
//}
//Yii::$app->debris->p($model->getNextStatuses());
//Yii::$app->debris->p($model->getWorkflowStatus()->getId());
//Yii::$app->debris->p($model->getStartTransitions());

//echo 'status id    = ' . $model->getWorkflowStatus()->getId();
//echo 'status label = ' . $model->getWorkflowStatus()->getLabel();
//if( $model->hasWorkflowStatus()) {
//
//    // ask the WorkflowSource
//    $transitions = $model
//        ->getWorkflowSource()
//        ->getTransitions($model->getWorkflowStatus()->getId());
//
//    foreach( $transitions as $transition ) {
//        echo $transition->getEndStatus()->getId();
//    }
//}

//Yii::$app->debris->p($radioList);

?>

<div class="row">
    <div class="col-lg-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title">基本信息</h3>
            </div>
            <div class="box-body">
                <?php $form = ActiveForm::begin([
                    'fieldConfig' => [
//                        'template' => "<div class='col-sm-1 text-right'>{label}</div><div class='col-sm-11'>{input}\n{hint}\n{error}</div>",
                    ],
                ]); ?>
                <div class="col-sm-12">
                    <?= $form->field($model, 'cate_id')->widget(Select2::class, [
                        'data' => $cates,
                        'options' => ['placeholder' => '请选择'],
                        'pluginOptions' => [
                            'allowClear' => true
                        ],
                    ]);?>
                    <?= $form->field($model, 'content')->textarea(['rows'=>3]) ?>
                    <?= $form->field($model, 'remind')->radioList(\addons\Flow\common\enums\RemindTypeEnum::getMap()) ?>
                    <?= $form->field($model, 'covers')->widget(common\widgets\webuploader\Files::class, [
                        'config' => [
                            'pick' => [
                                'multiple' => true,
                            ],
                        ]
                    ])->hint('第一张图片将作为主图,支持同时上传多张图片,多张图片之间可拖动调整位置'); ?>

                </div>
                <div class="form-group">
                    <div class="col-sm-12 text-center">
                        <button class="btn btn-primary" type="submit">保存</button>
                        <span class="btn btn-white" onclick="history.go(-1)">返回</span>
                    </div>
                </div>
                <?php ActiveForm::end(); ?>
            </div>
        </div>
    </div>
</div>
